<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<div id="container"><span style="display:contents">X</span></div>
<script>
  test(() => {
    document.body.offsetTop;
    // Did not reproduce with attachShadow().
    container.attachShadow({mode: 'open'});
  }, "Recalculate text style after removed from flat tree should not crash.");
</script>
